package tianrun.ziguan.api.calculate.config.service.asset.instance.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import tianrun.ziguan.api.calculate.config.dao.TAssetStaticPropertiesInstanceMapper;
import tianrun.ziguan.api.calculate.config.dto.request.AssetStaticPropertiesInstanceVO;
import tianrun.ziguan.api.calculate.config.entity.TAssetStaticPropertiesInstance;
import tianrun.ziguan.api.calculate.config.service.asset.instance.ITAssetStaticPropertiesInstanceService;
import tianrun.ziguan.api.calculate.config.utils.CollectionUtil;

import java.util.Collections;
import java.util.List;
import java.util.Set;

@Service
public class TAssetStaticPropertiesInstanceServiceImpl extends ServiceImpl<TAssetStaticPropertiesInstanceMapper, TAssetStaticPropertiesInstance> implements ITAssetStaticPropertiesInstanceService {
    @Override
    public List<TAssetStaticPropertiesInstance> listByModuleIds(Set<Long> ids) {
        if (CollectionUtil.isEmpty(ids)) {
            return Collections.emptyList();
        }
        return list(Wrappers.<TAssetStaticPropertiesInstance>lambdaQuery().eq(TAssetStaticPropertiesInstance::getIsValid, true).in(TAssetStaticPropertiesInstance::getModuleId, ids));
    }

    @Override
    public List<AssetStaticPropertiesInstanceVO> listVOByCalAssetIds(Set<Long> ids) {
        if (CollectionUtil.isEmpty(ids)) {
            return Collections.emptyList();
        }
        return baseMapper.listByCalAssetIds(ids);
    }
    @Override
    public List<AssetStaticPropertiesInstanceVO> listVOByAssetNums(Set<String> assetNums) {
        if (CollectionUtil.isEmpty(assetNums)) {
            return Collections.emptyList();
        }
        return baseMapper.listByCalAssetNums(assetNums);
    }
}
